package com.arron.algorithm.leetcodetop100.链表;

import com.arron.algorithm.leetcodetop100.ListNode;

/**
 * leetcode 83 ,删除有序链表中重复的节点
 * 删除重复的节点
 */
public class 删除有序链表中重复的节点 {

    public ListNode deleteDuplicates(ListNode head) {
        if(head == null) return head;
        ListNode temp = head;
        while (temp.next != null){
            if (temp.next.val == temp.val){

                temp.next = temp.next.next;
            }else {
                temp = temp.next;
            }
        }
        return head;
    }


}

